﻿<?php if( ! defined('BASEPATH')) exit('No direct script access allowed');
/********************
 *@param function:OplusCms 前臺 頁面管理
 *@param datetime 2012-01-05
 *@param author solgh
 ********************/
require APPPATH.'/libraries/REST_Controller.php';
class Messages extends REST_Controller{
    public function __construct(){
        parent::__construct();
        $token = $this->input->get_post('token');
        $this->load->model('admins_mdl');
        $query = $this->admins_mdl->get_admins_by_token($token);
        if(!$query){
            $this->response(array('error' => 'token is error','status'=>0), 200);
        }
        $this->member = $query;

    }

    public function message_get(){
        if($this->member) {
            $palyer_id = $this->input->get_post('palyer_id');
            $this->load->library('message');
            if (!empty($palyer_id)) {
                $this->admins_mdl->edit_palyer_admins(array('palyer_id' => ''), $palyer_id);
                $this->admins_mdl->edit_admins(array('palyer_id' => $palyer_id), $this->member['id']);
                $this->response(array('allresponses' => $response, "status" => 1), 200); 
            }

        }

    }

}